<!-- <template>
  <view class="content">
    <button @click="open">test1中的按钮</button>
    <button @click="onTest">测试</button>
    <button @click="onTest2">读取</button>
  </view>
</template> -->

<!-- <script module="render" lang="renderjs">
export default {
    methods: {
        _inputFocus (event) {
            document.querySelector('#input input').select()
        }
    }
}
</script> -->

<!-- <script setup>
</script> -->
<!-- <style lang="scss" scoped></style> -->
<template>
  <view>
    <view>--------------</view>
    <web-view src="/hybrid/html/local.html"></web-view>
  </view>
</template>
<script>
var wv //计划创建的webview
export default {
  onReady() {
    // #ifdef APP-PLUS
    var currentWebview = this.$scope.$getAppWebview() //此对象相当于html5plus里的plus.webview.currentWebview()。在uni-app里vue页面直接使用plus.webview.currentWebview()无效
    setTimeout(function () {
      wv = currentWebview.children()[0]
      wv.setStyle({ top: 150, height: 300 })
    }, 1000) //如果是页面初始化调用时，需要延时一下
    const originalData = { name: 'offlinedata', age: 25, hobbis: ['篮球', '足球'] }
    const jsonString = JSON.stringify(originalData)
    console.log(jsonString)
    const jsCode = `localStorage.setItem('data', '${jsonString}')`
    // const jsCode = "localStorage.setItem('data', 'jsonString')"
    console.log(jsCode)

    currentWebview.evalJS(jsCode)
    // #endif
  },
}
</script>
